#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <string>
using namespace std;

class Solution {
public:
    long long reverse(int x) {
        string str = to_string(x);
        if(x < 0) std::reverse(str.begin()+1, str.end());
        else std::reverse(str.begin(), str.end());
        long long res = stoll(str);
        if(res > INT32_MAX || res < INT32_MIN) return 0;
        return res;
    }
};

int main(){
    Solution solution;
    int x = 1534236469;
    cout<<solution.reverse(x);
    return 0;
}